From: | Colin Wenzel |
Date: | 25 Aug 99 at 10:32:44 |
Subject: | Re: Array limits? |
From: Colin Wenzel <colstv@hotkey.net.au>
On 25-Aug-99, Damir Arh wrote:
>From: Damir Arh <damir.arh@guest.arnes.si>
>Hello,
>I just came accross something the other day. I declared a huge array:
>char buffer[50000];
>Everything was fine when I compiled the program, but nasty bugs where
>occuring all the time, particularly Corrupt Memory List. After I reduced
>the buffer to the size of 5000 everything was fine. I'd like to know
>whether there are really any limits to the size of an array.
>BTW, I'm using GCC if that is of any importance.
There may be a problem using A4 relative (DT) references on
programs with a data segment greater than $7FFF bytes (32K)
in size. Or maybe you just had a bug in your code that ran
off the end.....
For static buffers that big, you should use AllocMem(),
or AllocVec(), that way the memory can be returned to the system
when it is not being used.
Otherwise, the loader will allocate the 50K (or whatever)
for the whole duration of the program, (until it unloads)
No other task will be able to use it...
----------------------------------------------------
Colin Wenzel. Queensland, Australia.
EMAIL: colstv@hotkey.net.au
URL: http://www.hotkey.net.au/~colstv/
'AMIGA' 4000T With CS-III 68060 / 50Mhz 150Mb RAM.
----------------------------------------------------